import java.awt.Graphics;
import java.awt.Color;
import java.awt.Container;
import javax.swing.JFrame;
import javax.swing.JPanel;

/**
Sets viewable window for game
*/
public class GraphicsClass extends JPanel 
{
	/*
	public void paintComponent(Graphics g)
	{
	super.paintComponent(g);
	
	int xCenter = getWidth() / 2;
	int yCenter = getHeight() / 2;
	if (xCenter > yCenter){
		int width = yCenter * (9/4); //big circle
		g.setColor(Color.CYAN);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width * 2/3; //white circle
		g.setColor(Color.RED);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		width = width/2; //little circle
		g.setColor(Color.BLUE);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width/6;
		g.setColor(Color.GREEN);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
	}
	else{
		int width = xCenter * (9/4); //big circle
		g.setColor(Color.CYAN);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width * 2/3; //white circle
		g.setColor(Color.red);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		width = width/2; //little circle
		g.setColor(Color.BLUE);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width/6;
		g.setColor(Color.GREEN);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
	}
	}
	
	*/
	
 /**
 Creates the four rings of the circle depending on which side (height or width)
 is longer
 @param g   graphic to be painted
 */
	public void paintComponent(Graphics g)
	{
	super.paintComponent(g);
	
	int xCenter = getWidth() / 2;
	int yCenter = getHeight() / 2;
	if (xCenter > yCenter){
		
		int size = yCenter * 3/2;
		int width = size * (5/4); //big circle
		g.setColor(Color.BLACK);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width - 10; //big circle
		g.setColor(Color.GRAY);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = size * (1);
		g.setColor(Color.BLACK);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width - 10; //white circle
		g.setColor(Color.GRAY);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		width = size * 3/4; //little circle
		g.setColor(Color.BLACK);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width - 10; //little circle
		g.setColor(Color.GRAY);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		width = size * 1/2; //little circle
		g.setColor(Color.BLACK);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width - 10; //little circle
		g.setColor(Color.GRAY);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		width = size * 1/4;
		g.setColor(Color.BLACK);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width- 10;
		g.setColor(Color.gray);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = width/6;
		g.setColor(Color.black);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
	}
	else{
		int size = xCenter * 3/2;
		int width = size * (5/4); //big circle
		g.setColor(Color.CYAN);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		width = size * (1);
		g.setColor(Color.PINK);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		
		width = size * 3/4; //little circle
		g.setColor(Color.BLUE);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		width = size * 1/2; //little circle
		g.setColor(Color.RED);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);		
		
		width = size * 1/4;
		g.setColor(Color.GREEN);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
		
		
		width = width/6;
		g.setColor(Color.black);
		g.fillOval(xCenter - (width / 2), yCenter - (width/2), width, width);
	}
	}
  /**
  Main method to set window, Graphics panel and container
  Sets everything to visible
  @param args
  */
	public static void main(String[] args)
	  {
	    JFrame window = new JFrame("Circle 2048");
	    window.setBounds(600, 600, 600, 600);
	    window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
	    GraphicsClass panel = new GraphicsClass();
	    panel.setBackground(Color.WHITE);
	    Container c = window.getContentPane();
	    c.add(panel);
	    window.setVisible(true);
	  }

}
